package xin.tomdonkey.chat.tcp;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.nio.charset.StandardCharsets;

/**
 * @author guolinyuan
 */
public class Server
{
    public static void main(String[] args) throws IOException
    {
        ServerSocket serverSocket = new ServerSocket(8001);
        Socket socket = serverSocket.accept();

        InputStream inputStream = socket.getInputStream();

        InputStreamReader isr = new InputStreamReader(inputStream , StandardCharsets.UTF_8);
        BufferedReader br = new BufferedReader(isr);

        String s;
        do
        {
            s = br.readLine();
            System.out.println(s);
        }
        while (s!= null);

    }
}
